package com.zzx.controller;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.zzx.model.User;

@Controller
@RequestMapping("user")
public class GetUserController {
	
	@RequestMapping("guser")
	public @ResponseBody Object getUser(@RequestParam("aaa") User user) {
		
		throw new NullPointerException("数据库不见了");
		
	//	return user;
		
	}

	@RequestMapping("mv")
	public ModelAndView hellomv() {
		
		Map<String, Object> map=new HashMap<>();
		map.put("banner","你是个垃圾");
		
		ModelAndView andview = new ModelAndView("h",map);
		return andview;
	}
	
	@RequestMapping("print")
	public void aaa(HttpServletResponse resp) {
		resp.setContentType("text/html;charset=utf-8");
	//	pw.println("<h1>这里是打印输出流</h1>");
		try {
			resp.getWriter().println("<h1>这里是打印输出流</h1>");
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
}
